﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" Inherits="Pages_Reports_IncomeReport" Codebehind="IncomeReport.aspx.cs" %>

<%@ Register TagPrefix="avg" Namespace="Avg.Controls" Assembly="SmartPager" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="using" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="header" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="Server">
    <div style="margin: 10px 3px 0 3px">
        <h1 style="text-indent: 10px">
            Income Report</h1>
        <div class="description">
            <b style="color: Red">*</b> Required
        </div>
        <asp:Panel ID="panel1" runat="server" DefaultButton="btnSearch" BackColor="AliceBlue">
            <table style="margin: 15px;" class="field">
            <tr>
                <td>
                    From Date:
                </td>
                <td>
                    <asp:TextBox ID="txtFromDate" runat="server" CssClass="datepicker"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ErrorMessage="*"
                        ControlToValidate="txtFromDate"></asp:RequiredFieldValidator>
                </td>
                <td>
                    To Date:
                </td>
                <td>
                    <asp:TextBox ID="txtToDate" runat="server" CssClass="datepicker"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ErrorMessage="*"
                        ControlToValidate="txtToDate"></asp:RequiredFieldValidator>
                </td>
                <td>
                    Boat#:
                </td>
                <td>
                    <asp:DropDownList ID="ddlBoat" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    Agent#:
                </td>
                <td>
                    <asp:TextBox ID="txtAgentID" runat="server" />
                </td>
                <td>
                    Client type:
                </td>
                <td>
                    <asp:DropDownList ID="ddlClientType" runat="server">
                        <asp:ListItem Value="-1">All types</asp:ListItem>
                        <asp:ListItem Value="0">Agent</asp:ListItem>
                        <asp:ListItem Value="1">WI</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    Received Method:
                </td>
                <td>
                    <asp:DropDownList ID="ddlPaidMethod" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td colspan="6">
                    <asp:LinkButton CssClass="button" ID="btnSearch" runat="server" ToolTip="View button"
                        OnClick="btnSearch_Click"><span>Generate</span></asp:LinkButton>
                    <asp:LinkButton CssClass="button" ID="btnReport" runat="server" ToolTip="Print button"
                        OnClick="btnReport_Click"><span>Export file</span></asp:LinkButton>
                </td>
            </tr>
        </table></asp:Panel>
        <div id="set1">
            <asp:GridView ID="grv" runat="server" CssClass="grid" AllowSorting="true" AutoGenerateColumns="false"
                Style="border-color: #eaeaea" DataKeyField="BoatID">
                <Columns>
                    <asp:BoundField HeaderText="Boat" DataField="BoatID" HeaderStyle-Width="80" HeaderStyle-HorizontalAlign="Center">
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Booking Code" DataField="ReservationCode" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:TemplateField HeaderText="Customer #" HeaderStyle-Width="50" ItemStyle-Font-Bold="true">
                        <ItemTemplate>
                            <a href="#" onclick="javascript:popup('/Pages/Agents/AgentPopup.aspx?AgentID=<%# Eval("GuestID") %>')">
                                <%# Eval("GuestID") %></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="Type" DataField="ClientType" HeaderStyle-Width="80" HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:BoundField HeaderText="Sub Total" DataField="SubTotal" HeaderStyle-Width="80"
                        ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:#,##0.##}">
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Balance" DataField="Balance" HeaderStyle-Width="80" ItemStyle-HorizontalAlign="Right"
                        HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:#,##0.##}"></asp:BoundField>
                    <asp:BoundField HeaderText="Amount" DataField="Amount" HeaderStyle-Width="80" DataFormatString="{0:#,##0.##}"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                    <asp:BoundField HeaderText="Average" DataField="Average" HeaderStyle-Width="80" ItemStyle-HorizontalAlign="Right"
                        HeaderStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.##}"></asp:BoundField>
                    <asp:BoundField HeaderText="Currency" DataField="CurrencyAmountName" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                    <asp:BoundField HeaderText="Total" DataField="TotalAmt" HeaderStyle-Width="100" HeaderStyle-HorizontalAlign="Center"
                        DataFormatString="{0:#,##0.##}" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                    <asp:BoundField HeaderText="Received By" DataField="ReceivedBy" HeaderStyle-Width="40"
                        HeaderStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:BoundField HeaderText="Paid Method" DataField="PaidMethodName" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:BoundField HeaderText="Paid Date" DataField="PaymentDate" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:d}"></asp:BoundField>
                </Columns>
                <HeaderStyle CssClass="gridheader" />
                <RowStyle CssClass="gridrow" />
                <AlternatingRowStyle CssClass="alternatingrow" />
            </asp:GridView>
            <avg:SmartPager ID="smartPager" runat="server" Visible="false" NavigatePreviousText="« Previous"
                NavigateNextText="Next »">
            </avg:SmartPager>
        </div>
    </div>

    <script type="text/javascript">
        $(function () {

            // Datepicker
            $(".datepicker").datepicker({
                constrainInput: true,
                onSelect: function () { }
            });
        });

        function popup(link) {
            testwindow = window.open(link, "mywindow", "location=1,status=1,scrollbars=1,width=640,height=500");
            testwindow.moveTo(0, 0);
        }  

    </script>

</asp:Content>
